package clientmain.auth.header;


import org.apache.cxf.endpoint.Client;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

public class DynamicClient {
	public static void main(String[] args) {
		JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); 
		Client client = dcf.createClient("http://10.71.58.54:9999/hysoft?wsdl");
		client.getOutInterceptors().add(new AuthInterceptor("wz", "1234"));
		client.getOutInterceptors().add(new LoggingOutInterceptor());
		System.out.println(client);
		Object[] res = null;
		try {
			res = client.invoke("sayHi","kk");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("Echo response: " + res[0]);
	}
}
